/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.desitek.thunder.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dt
 */
@Entity
@Table(name = "user_group_list",   schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserGroupList.findAll", query = "SELECT u FROM UserGroupList u"),
    @NamedQuery(name = "UserGroupList.findById", query = "SELECT u FROM UserGroupList u WHERE u.id = :id"),
    @NamedQuery(name = "UserGroupList.findByAppUserId", query = "SELECT u FROM UserGroupList u WHERE u.appUserId = :appUserId"),
    @NamedQuery(name = "UserGroupList.findByUserGroupId", query = "SELECT u FROM UserGroupList u WHERE u.userGroupId = :userGroupId"),
    @NamedQuery(name = "UserGroupList.findByInsertDate", query = "SELECT u FROM UserGroupList u WHERE u.insertDate = :insertDate"),
    @NamedQuery(name = "UserGroupList.findByUpdateDate", query = "SELECT u FROM UserGroupList u WHERE u.updateDate = :updateDate")})
public class UserGroupList implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "app_user_id")
    private BigInteger appUserId;
    @Column(name = "user_group_id")
    private Integer userGroupId;
    @Column(name = "insert_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date insertDate;
    @Column(name = "update_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateDate;
    @JoinColumn(name = "id", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private UserGroup userGroup;
    @JoinColumn(name = "id", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private AppUser appUser;

    public UserGroupList() {
    }

    public UserGroupList(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigInteger getAppUserId() {
        return appUserId;
    }

    public void setAppUserId(BigInteger appUserId) {
        this.appUserId = appUserId;
    }

    public Integer getUserGroupId() {
        return userGroupId;
    }

    public void setUserGroupId(Integer userGroupId) {
        this.userGroupId = userGroupId;
    }

    public Date getInsertDate() {
        return insertDate;
    }

    public void setInsertDate(Date insertDate) {
        this.insertDate = insertDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public UserGroup getUserGroup() {
        return userGroup;
    }

    public void setUserGroup(UserGroup userGroup) {
        this.userGroup = userGroup;
    }

    public AppUser getAppUser() {
        return appUser;
    }

    public void setAppUser(AppUser appUser) {
        this.appUser = appUser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserGroupList)) {
            return false;
        }
        UserGroupList other = (UserGroupList) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.desitek.thunder.entity.UserGroupList[ id=" + id + " ]";
    }
    
}
